package com.mysky.client.mvp.audioplayer.popup;

import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.PopupViewImpl;

public class PopupAudioView extends PopupViewImpl implements
		PopupAudioPresenter.MyView {

	private final Widget widget;

	public interface Binder extends UiBinder<Widget, PopupAudioView> {
	}

	@Inject
	public PopupAudioView(final EventBus eventBus, final Binder binder) {
		super(eventBus);
		widget = binder.createAndBindUi(this);
	}

	@UiField
	HTMLPanel audioPanel;

	@Override
	public void setInSlot(Object slot, Widget content) {
		if (slot == PopupAudioPresenter.SLOT_AUDIO) {
			audioPanel.clear();
			if (content != null)
				audioPanel.add(content);
		} else {
			super.setInSlot(slot, content);
		}
	}

	@Override
	public Widget asWidget() {
		return widget;
	}
}
